package com.djp.computerServer.controller;

import com.djp.computerServer.bean.GoodsComment;
import com.djp.computerServer.service.GoodsCommentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/goodsComment")
public class GoodsCommentController extends BaseController<GoodsCommentService>{
    @RequestMapping("/add")
    @ResponseBody
    public Map addGoodsComment(@RequestBody GoodsComment goodsComment) {
        return buildMap("增加商品评论", service.add(goodsComment));
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Map delGoodsComment(@RequestBody GoodsComment goodsComment) {
        return buildMap("删除商品评论", service.delete(goodsComment));
    }

    @RequestMapping("/update")
    @ResponseBody
    public Map updateGoodsComment(@RequestBody GoodsComment goodsComment) {
        return buildMap("更新商品评论", service.add(goodsComment));
    }

    @RequestMapping("/getAll")
    @ResponseBody
    public Map getAllGoodsComment() {
        return buildMap("获取全部商品评论", service.getAll());
    }

    @RequestMapping("/getOne")
    @ResponseBody
    public Map getOneGoodsComment(@RequestBody GoodsComment goodsComment) {
        return buildMap("获取一个商品评论", service.getOne(goodsComment));
    }
}
